export class Application { tests: tests.TestPage = null;
scrollLeft = ko.observable(1);
scrollTop = ko.observable(2);
constructor(private _body = document.body) { this.scrollLeft(this.scrollLeft() + 1);
this.scrollTop(this.scrollTop() + 2);
earlyElement('Loading test list...'); this.tests = new tests.TestPage();
earlyElement('Rendering...'); private _completeBoot() { var tmpHost = document.createElement('div'); ko.renderTemplate('Application', this, null, tmpHost); for (var i = 0; i < tmpHost.children.length; i++) { if (tmpHost.children.item(i).tagName) { child = <any>tmpHost.children.item(i);
document.body.appendChild(child);
var startAnimation = Date.now();
var endAnimation = startAnimation + 400;
var containerWidth = child.offsetWidth;
var pageWidth = earlyElement.background.offsetWidth;
var continueAnimation = () => { if (now >= endAnimation) { child.style.left = '0px';
var ratio = (now - startAnimation) / (endAnimation - startAnimation);
child.style.left = (-containerWidth + ratio * containerWidth) + 'px';
earlyElement.background.style.left = (ratio * containerWidth) + 'px';
if (typeof requestAnimationFrame === 'function')
requestAnimationFrame(continueAnimation)
setTimeout(continueAnimation, 1);
alert('Application._completeBoot:continueAnimation ' + animationError.message + '\n' + animationError.stack);